using System.Text.RegularExpressions;
using MalwareMultiScan.Backends.Backends.Abstracts;
using MalwareMultiScan.Backends.Services.Interfaces;

namespace MalwareMultiScan.Backends.Backends.Implementations
{
    /// <inheritdoc />
    public class WindowsDefenderScanBackend : AbstractLocalProcessScanBackend
    {
        /// <inheritdoc />
        public WindowsDefenderScanBackend(IProcessRunner processRunner) : base(processRunner)
        {
        }
        
        /// <inheritdoc />
        public override string Id { get; } = "windows-defender";

        /// <inheritdoc />
        protected override string BackendPath { get; } = "/opt/mpclient";

        /// <inheritdoc />
        protected override Regex MatchRegex { get; } =
            new Regex(@"EngineScanCallback\(\): Threat (?<threat>[\S]+) identified",
                RegexOptions.Compiled | RegexOptions.Multiline);
        
        /// <inheritdoc />
        protected override bool ParseStdErr { get; } = true;

        /// <inheritdoc />
        protected override string GetBackendArguments(string path)
        {
            return path;
        }
    }
}